<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <title></title>
    <script src="/Public/js/mui.min.js"></script>
    <link href="/Public/css/mui.min.css" rel="stylesheet"/>
    <link href="/Public/css/basic.css" rel="stylesheet"/>
    <link href="/Public/css/tixian.css" rel="stylesheet"/>
    <script type="text/javascript" src="/Public/js/jquery.min.js"></script>
    <script type="text/javascript" charset="utf-8">
        mui.init();
    </script>
</head>
<body>
<header class="mui-bar mui-bar-nav" style="background: #0C0C0C;">
    <a class="mui-icon mui-icon-left-nav mui-pull-left" href="javascript:history.back()" style="color:white;"></a>
    <a class="mui-icon mui-icon-reply mui-pull-right" ></a>
    <h1 class="mui-title" style="color:white;">充值中心</h1>
</header>
<div style="height: 5rem;"></div>
<div class="section3">
    <div class="container">
        <div class="section3-1">
            <img src="/Public/images/monmon.png"/>
        </div>
    </div>
</div>
<div class="ge"></div>
<div class="section2">
    <form action="/index.php/Home/recharge/index" method="post" id="inputForm">
        <ul>
            <li class="mui-clearfix">
                <span>客户手机号</span>
                <input type="number" id="tel" name="tel" value="" placeholder="请填写正确手机号"/>
            </li>
            <li class="mui-clearfix">
                <span>推荐人手机号</span>
                <input type="number" id="phone" name="phone" value="" placeholder="请填写正确手机号"/>
            </li>
            <li class="mui-clearfix">
                <span>推荐人昵称</span>
                <input type="text" style="color: #c1c1c1" id="nickname"   readonly/>
            </li>
            <li class="mui-clearfix">
                <span>推荐人工号</span>
                <input type="number" name="job_no" id="job_no" style="color: #c1c1c1"  readonly/>
            </li>
            <li class="mui-clearfix">
                <span>充值员工工号</span>
                <input type="number" name="recharge_no" id="recharge_no" style="color: #c1c1c1" value="{$recharge_no}"  readonly/>
            </li>
            <li class="mui-clearfix">
                <span>充值金额</span>
                <input type="text" id="money" name="money" value="{$money}" style="color: #c1c1c1"   readonly/>
            </li>

        </ul>
        <div class="sub">
            <input type="button" id="recharge" value="充值"/>
        </div>
    </form>
</div>


</body>
<script type="text/javascript" >
    mui.init();
    mui('body').on( 'tap' , 'a' , function(){
        document.location.href=this.href;
    })

    $(document).ready(function(){
        $('#tel').blur(function(){
            var tel = $('#tel').val();
            if(tel ==''){
                mui.toast('客户手机号不能有空');
                return false;
            }
            var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
            if (!myreg.test(tel)) {
                mui.toast("手机号格式有误");
                return false;
            }
        })

        $("#phone").blur(function(){
            var phone = $("#phone").val();
            var myreg=/^[1][3,4,5,7,8][0-9]{9}$/;
            if (!myreg.test(phone)) {
                mui.toast("手机号格式有误");
                return false;
            } else {
                $.ajax({
                    type: "POST",
                    url: "/index.php/Home/wei/get_info",
                    data: {"phone":phone},
                    dataType: "json",
                    success: function(data){
                        $("#nickname").attr("value",data.nick_name);
                        $("#job_no").attr("value",data.bind_id);
                    }
                });
            }
        });
        $('#recharge').click(function(){

            $.ajax({
                type: "POST",
                url: "/index.php/Home/recharge/index",
                data:$('#inputForm').serialize(),
                dataType: "json",
                success: function(data){
                    console.log(data)
                    if(data.status==2){
                        mui.toast(data.str);

                    }

                }
            });
        });

    });
</script>


</html>